/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * Description: Hmfs-tools mkfs command parser
 */

#ifndef MKFS_COMMAND_H
#define MKFS_COMMAND_H

#include <string>
#include <sys/types.h>

#include "hmfs_command.h"

namespace OHOS {
namespace Hmfs {
class MkfsCmdParser : public CmdParser {
public:
    ~MkfsCmdParser() = default;

    static MkfsCmdParser &GetInstance()
    {
        static MkfsCmdParser instance;
        return instance;
    }
    ArgParseResult Parse(int32_t argc, char *argv[]);

private:
    MkfsCmdParser();
    MkfsCmdParser(const MkfsCmdParser &) = delete;
    MkfsCmdParser &operator=(const MkfsCmdParser &) = delete;
    void ConfigOptionPacket(void);
    void ConfigDefaultOption(void);
    bool CheckOptions(void);
    void ShowCmdInfo(void);
    void ShowCmdUsage(void);
    ArgParseResult ProcessHeapBasedAlloc(const std::string &argValue);
    ArgParseResult ShowVersion(const std::string &argValue);
    ArgParseResult ProcessDeviceList(const std::string &argValue);
    ArgParseResult ProcessColdFileExt(const std::string &argValue);
    ArgParseResult ProcessHotFileExt(const std::string &argValue);
    ArgParseResult ProcessForceOverwrite(const std::string &argValue);
    ArgParseResult ProcessDefaultOptionSet(const std::string &argValue);
    ArgParseResult ProcessHelp(const std::string &argValue);
    ArgParseResult ProcessVolumeLabel(const std::string &argValue);
    ArgParseResult ProcessZonedMode(const std::string &argValue);
    ArgParseResult ProcessQuietMode(const std::string &argValue);
    ArgParseResult ProcessSrandSeed(const std::string &argValue);
    ArgParseResult ProcessRootOwner(const std::string &argValue);
    ArgParseResult ProcessSegsPerSection(const std::string &argValue);
    ArgParseResult ProcessSparseMode(const std::string &argValue);
    ArgParseResult ProcessDiscardPolicy(const std::string &argValue);
    ArgParseResult ProcessTimestamp(const std::string &argValue);
    ArgParseResult ProcessUuid(const std::string &argValue);
    ArgParseResult ProcessWantedSectorSize(const std::string &argValue);
    ArgParseResult ProcessSectionsPerZone(const std::string &argValue);

    CmdConfig cmdPara_;
};

} // namespace Hmfs
} // namespace OHOS
#endif // MKFS_COMMAND_H
